import * as TYPES from "../action-types"
let obj = {
    user: {},
    type:null,
    falg: false,
    left: JSON.parse(sessionStorage.getItem("left")),
    rit: JSON.parse(sessionStorage.getItem("rit")),
    users:JSON.parse(sessionStorage.getItem("users")),
}
const homeReducer = function (state = obj, action) {
    state = JSON.parse(JSON.stringify(state))
    let {
        type,
        payload
    } = action
    switch (type) {
        //用户在首页请求
        case TYPES.HOME_GET_LIST:

            break
            //用户在首页点击的信息
        case TYPES.HOME_CLICK:

            state.user = payload
            console.log("--------", state.user);
            ;
            break
            //touch事件封装
        case TYPES.HOME_TOUCH:
            state = JSON.parse(JSON.stringify(state))
            state.type = payload
            // state.callback()
            console.log(state);
            console.log("----touch事件封装----》", payload ,state.type);
            ;
            break

        case TYPES.HOME_PUBLISHED_WORKS: 
            console.log(payload);

        ;break
    }
    console.log(state);
    return JSON.parse(JSON.stringify(state))
}
export default homeReducer